package com.shanzmoo.admin.web;

import com.shanzmoo.base.bean.SHttpResponse;
import com.shanzmoo.db.report.entity.vo.OrderTradeTrend;
import com.shanzmoo.db.report.entity.vo.ProductSalesVO;
import com.shanzmoo.db.report.entity.vo.StatisticsVO;
import com.shanzmoo.db.report.service.IndexService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 统计-首页
 *
 * @author： Gzhao 2021/1/23
 */
@Api(tags = "统计-首页")
@RestController
@RequestMapping("/api/index")
public class IndexController {

    @Autowired
    private IndexService indexService;

    @GetMapping("/statistics")
    public SHttpResponse<StatisticsVO> getStatistics(){
        return SHttpResponse.ok(indexService.getStatistics());
    }

    @GetMapping("/rootOrderTrend")
    public SHttpResponse<List<OrderTradeTrend>> getRootOrderTrend(){
        return SHttpResponse.ok(indexService.getRootOrderTrend());
    }

    @GetMapping("/mallOrderTrend")
    public SHttpResponse<List<OrderTradeTrend>> getMallOrderTrend(){
        return SHttpResponse.ok(indexService.getMallOrderTrend());
    }

    @GetMapping("/thirdPlatformOrderTrend")
    public SHttpResponse<List<OrderTradeTrend>> getThirdPlatformOrderTrend(){
        return SHttpResponse.ok(indexService.getThirdPlatformOrderTrend());
    }

    @GetMapping("/productSalesSort")
    public SHttpResponse<List<ProductSalesVO>> getProductSalesSort(){
        return SHttpResponse.ok(indexService.getProductSalesSort());
    }


}
